import Vue from "vue";
import Vuex from "vuex"

Vue.use(Vuex)

export default new Vuex.Store({
    state:{
        month:null,
        userId:null,
        token:null,
        headers:null
    },
    mutations:{
        changeMonth(state,value){
            state.month=value
        },
        saveUserInfo(state,value){
            state.userId=value.userId;
            state.token=value.token,
            state.headers={
                "Content-Type":"application/x-www-form-urlencoded",
                "token":`${value.userId}_${value.token}`
            }
        },
        delToken(state){
            state.userId=null;
            state.token=null;
            state.headers=null;
            state.month=null
        }
    }
})